//
//  BQClickShopingView.m
//  BeeQuick
//
//  Created by AaronWei on 2017/7/10.
//  Copyright © 2017年 BecomeRich. All rights reserved.
//

#import "BQClickShopingView.h"

@interface BQClickShopingView ()

@property (weak, nonatomic) IBOutlet UILabel *countLabel;

@end

@implementation BQClickShopingView

+ (instancetype)clickShopingView {
    
    return [[NSBundle mainBundle] loadNibNamed:@"BQClickShopingView" owner:nil options:nil].lastObject;
    
}

- (void)setCount:(NSInteger)count {
    
    _count = count;
    
    _count = count;
    
    _reduceButton.hidden = !count;
    
    _countLabel.hidden = !count;
    
    _countLabel.text = [NSString stringWithFormat:@"%ld", count];
    
}

- (IBAction)clickButton:(UIButton *)sender {
    
    if (sender == _reduceButton) {
        
        _clickIncreaseButton = NO;
        
        self.count--;
        
        [self sendActionsForControlEvents:UIControlEventValueChanged];
        
    } else {
        
        _clickIncreaseButton = YES;
        
        self.count++;
        
        [self sendActionsForControlEvents:UIControlEventValueChanged];
        
    }
    
}

@end
